
package jtrimet;

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;
import java.util.Calendar;

class CalendarConverter extends AbstractSingleValueConverter
{
	public CalendarConverter()
	{
		super();
	}
	
	@Override
	public boolean canConvert(Class c)
	{
		return Calendar.class.isAssignableFrom(c);
	}

	@Override
	public Object fromString(String s)
	{

		Long l = new Long(s);
		
		Calendar c = Calendar.getInstance();
		c.setTimeInMillis(l.longValue());
		
		return c;
		
	}

	public static void main(String[] args)
	{
		CalendarConverter converter = new CalendarConverter();
		Calendar c = (Calendar) converter.fromString("1225665360000");
	}
	
}
